<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>写邮件</title>

	<link rel="stylesheet" href="${siteurl}plugins/select2/select2.css">
	[#include "/theme/adminlte/common/sites.html" /]
	[#include "/theme/adminlte/space/common.html" /]
	[#include "/theme/adminlte/mailbox/commons.html" /]

	[@header /]
</head>
<!-- ADD THE CLASS layout-top-nav TO REMOVE THE SIDEBAR. -->
<body class="hold-transition skin-blue layout-top-nav">
<div class="wrapper">

	<header class="main-header">
		[@nav  7 /]
	</header>
	<!-- Full Width Column -->
	<div class="content-wrapper">
		<div class="container">
			<!-- Main content -->
			<section class="content">
				<div class="row">
					[@mailboxleft 1/]
					<!-- /.col -->
					<div class="col-md-9">
						<form method="post" action="${siteurl}mailbox/sendmail.htm">
								<div class="box box-primary">
									<div class="box-header with-border">
										<h3 class="box-title">写一封信</h3>
									</div>
									<!-- /.box-header -->
									<div class="box-body">
										<div class="form-group">
											<select id="mailto" name="user" class="form-control" placeholder="To:">
											</select>
										</div>
										<div class="form-group">
											<input class="form-control" placeholder="标题:" name="title">
										</div>
										<div class="form-group">
											<textarea id="compose-textarea" class="form-control" style="height: 230px" name="note"></textarea>
										</div>
										<div class="form-group hidden">
											<div class="btn btn-default btn-file">
												<i class="fa fa-paperclip"></i> Attachment
												<input type="file" name="attachment">
											</div>
											<p class="help-block">Max. 32MB</p>
										</div>
									</div>
									<!-- /.box-body -->
									<div class="box-footer">
										<div class="pull-right">
											<button type="button" class="btn btn-default"><i class="fa fa-pencil"></i> 草稿</button>
											<button type="submit" class="btn btn-primary"><i class="fa fa-envelope-o"></i> 发送</button>
										</div>
										<button type="reset" class="btn btn-default"><i class="fa fa-times"></i> 取消</button>
									</div>
									<!-- /.box-footer -->
								</div>
								<!-- /. box -->
						</form>
						<!-- /. box -->
					</div>
					<!-- /.col -->
				</div>

			</section>
			<!-- /.content -->
		</div>
		<!-- /.container -->
	</div>
	<!-- /.content-wrapper -->

	[@footer /]
</div>
<!-- ./wrapper -->

[@scripts /]

<script src="${siteurl}plugins/select2/select2.full.min.js"></script>
<script src="${siteurl}plugins/select2/i18n/zh-CN.js"></script>
<script type="text/javascript">
    function formatRepo (repo) {
        console.log(repo);
        if (repo.loading) {
            return repo.text;
        }

        var markup = "<div class='select2-result-repository__title'>" + repo.name + "</div>";


        return markup;
    }
    function formatRepoSelection (repo) {
        return repo.name || repo.name;
    }
    $(document).ready(function () {
        $(document).ready(function () {
            $("#mailto").select2({
                ajax: {
                    url: '${siteurl}rest/member/name.htm',
                    data: function (params) {
                        var query = {
                            name: params.term,
                            type: 'public'
                        }
                        return query;
                    },
                    dataType:"json",
                    type:"POST",
                    processResults: function (data) {
                        return {
                            results: data.list
                        };
                    }
                },
                placeholder: '请输入要举行活动的场馆名称',
                escapeMarkup: function (markup) { return markup; }
                , templateResult: formatRepo,
                templateSelection: formatRepoSelection
            });
        });

    });
</script>

</body>
</html>



